package com.zhuss.core.db.dao.ext;

import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import com.zhuss.core.db.dao.gen.ConfigMapper;
import com.zhuss.core.db.entity.RepairSet;

@Mapper
public interface RepairSetDao extends ConfigMapper {

	@Select("SELECT value FROM t_config where type = #{value}")
	Integer getRepairPingJiaMaxDays(String value);

	
	@Select("SELECT r.id,h.create_time from t_repair r LEFT JOIN t_repair_hecha h ON r.id = h.repair_id where DATE_ADD(h.create_time,INTERVAL #{days} DAY) < NOW() and r.step=5 and r.audit=5 and h.result=1")
	List<Integer> getPingJiaDaysOutData(Integer days);
	

	//报修评价表添加内容
	@Insert("INSERT INTO t_repair_pingjia (repair_id,deal_user_id,content,create_time) VALUES (#{repair_id,jdbcType=INTEGER},#{deal_user_id,jdbcType=INTEGER},#{content,jdbcType=VARCHAR},now())")
	void insertRepairPingJia(RepairSet repairSet);
	
	
	//报修表更新状态
	@Update("update t_repair set step = #{step},audit = #{audit} where id = #{repair_id}")
	void updateRepairStatus(RepairSet repairSet);	
	
}